const format = (text, bold = false) => {
    const result = {
        text
    }
    if(bold){
        result.style = {
            fontWeight: 600
        }
    }
    return result;
}

const reportTitleContent = (role, verb) => {
    return message => [
        format('您在任务'),
        format(message.taskName, true),
        format(`下发布的报告被${role}`),
        format(message.userName, true),
        format(verb)
    ]
}

const likeTitleContent = (role) => {
    return message => [
        format('您在任务'),
        format(message.taskName, true),
        format(`下某篇报告下发布的评论“${message.scoreContent}”被${role}`),
        format(message.userName, true),
        format('点赞')
    ]
}

export const MESSAGE = [
    {
        tag: {
            type: 'success',
            tagText: '工人评价',
        },
        formatTitleContent: reportTitleContent('众包工人', '评价')

    },
    {
        tag: {
            type: 'warning',
            tagText: '发包方评价',
        },
        formatTitleContent: reportTitleContent('发包方', '评价')

    },
    {
        tag: {
            type: 'info',
            tagText: '工人协作'
        },
        formatTitleContent: reportTitleContent('众包工人', '协作')
    },
    {
        tag: {
            type: 'danger',
            tagText: '评论被点赞'
        },
        formatTitleContent: likeTitleContent('众包工人')
    },
    {
        tag: {
            type: 'danger',
            tagText: '评论被点赞'
        },
        formatTitleContent: likeTitleContent('报告作者')
    },
    {
        tag: {
            type: 'danger',
            tagText: '评论被点赞'
        },
        formatTitleContent: likeTitleContent('发包方')
    },
    {
        tag: {
            tagText: '工人关注'
        },
        formatTitleContent: message => [
            format('您被众包工人'),
            format(message.userName, true),
            format('follow')
        ]
    },
    {
        tag: {
            type: 'success',
            effect: 'dark',
            tagText: '受邀测试'
        },
        formatTitleContent: message => [
            format('您被发包方'),
            format(message.userName, true),
            format('邀请完成测试任务'),
            format(message.taskName, true)
        ]
    },
    {
        tag: {
            type: 'primary',
            tagText: '协作沟通'
        },
        formatTitleContent: message => [
            format('来自任务'),
            format(message.taskName, true),
            format('中的众包工人'),
            format(message.userName, true),
            format('的消息')
        ]
    },
    {
        tag: {
            type: "success",
            effect: 'dark',
            tagText: '协作确认'
        },
        formatTitleContent: message => [
            format('请确认接受您在协作任务'),
            format(message.taskName, true),
            format('中所选择的子任务')
        ]
    },
    {
        tag: {
            type: "warning",
            effect: 'dark',
            tagText: '下游接受'
        },
        formatTitleContent: message => [
            format('请尽快完成您在协作任务'),
            format(message.taskName,true),
            format('中的子任务，以免耽误下游完成该任务！')
        ]
    }
];
